Register new snapshots
authorAlex Crichton <alex@alexcrichton.com>
Wed, 30 Jul 2014 01:11:51 +0000 (18:11 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 30 Jul 2014 06:06:21 +0000 (23:06 -0700)
.travis.yml
Makefile.in
src/bin/cargo-version.rs
src/cargo/lib.rs
src/etc/dl-snapshot.py
src/etc/print-new-snapshot.py
src/snapshots.txt

index 2737490790bd0b058844001042e81f143a04d913..b897f3577773ca3cbfc248579c4e1c4c93cfca2b 100644 (file)
@@ -4,9 +4,10 @@ install:
   - sh ./.travis.install.deps.sh
 
 script:
+  - ./configure --local-rust-root=`pwd`/rustc
   - make
-  - make test -j4
-  - make install DESTDIR=${PWD}/destdir
+  - make test
+  - make distcheck
 
 env:
   - BITS=32
index bb3d5084a9bdfd02ee842f187504b94cbba61bda..6bd1b75e5ebd21a3c5283cde960c349ba392f902 100644 (file)
@@ -47,7 +47,7 @@ BIN_TARGETS_$(1) := $$(BIN_TARGETS:%=$$(TARGET_$(1))/%$$(X))
 endef
 $(foreach target,$(CFG_TARGET),$(eval $(call DIST_TARGET,$(target))))
 
-CARGO := $(TARGET_ROOT)/snapshot/cargo-nightly/bin/cargo$(X)
+CARGO := $(TARGET_ROOT)/snapshot/bin/cargo$(X)
 
 all: $(foreach target,$(CFG_TARGET),cargo-$(target))
 
@@ -58,7 +58,7 @@ endef
 $(foreach target,$(CFG_TARGET),$(eval $(call CARGO_TARGET,$(target))))
 
 $(CARGO): src/snapshots.txt
-       $(CFG_PYTHON) src/etc/dl-snapshot.py
+       $(CFG_PYTHON) src/etc/dl-snapshot.py $(CFG_BUILD)
        touch $@
 
 
index 4c5b1e0d22eb114b87f4784c0cc930e2b14968db..b313741353f7e9d2fa68f8e3061cefacf6506299 100644 (file)
@@ -27,7 +27,7 @@ fn main() {
 fn execute(_: Options, _: &mut MultiShell) -> CliResult<Option<()>> {
     debug!("executing; cmd=cargo-version; args={}", os::args());
 
-    println!("cargo {}", env!("CFG_VERSION"));
+    println!("{}", cargo::version());
 
     Ok(None)
 }
index 50925ae7c87d5dbc1360bf4a9651c9515d209430..3a8bfeaaa90f22408b80a861143b65b614941a06 100644 (file)
@@ -197,7 +197,7 @@ fn handle_cause(err: &CargoError, shell: &mut MultiShell) {
 }
 
 pub fn version() -> String {
-    (env!("CFG_VERSION")).to_string()
+    format!("cargo {}", env!("CFG_VERSION"))
 }
 
 fn flags_from_args<T: FlagParser>(args: &[String],
index eb8b5cb380caa511ebdd28bf92bdf382db3cd35e..aeee64dfc974ab77637d4cd686f1dc97c31361ec 100644 (file)
@@ -4,27 +4,35 @@ import os
 import subprocess
 import sys
 import tarfile
+import shutil
 
 f = open('src/snapshots.txt')
 lines = f.readlines()
 
 date = lines[0]
-mac = lines[1]
-linux = lines[2]
-win = lines[3]
-
-if 'linux' in sys.platform:
-    me = linux
-elif sys.platform == 'win32':
-    me = win
-elif sys.platform == 'darwin':
-    me = mac
+linux32 = lines[1]
+linux64 = lines[2]
+mac32 = lines[3]
+mac64 = lines[4]
+win32 = lines[5]
+triple = sys.argv[1]
+
+if triple == 'i686-unknown-linux-gnu':
+    me = linux32
+elif triple == 'x86_64-unknown-linux-gnu':
+    me = linux64
+elif triple == 'i686-apple-darwin':
+    me = mac32
+elif triple == 'x86_64-apple-darwin':
+    me = mac64
+elif triple == 'i686-pc-mingw32':
+    me = win32
 else:
-    raise Exception("no snapshot for the platform: " + sys.platform)
+    raise Exception("no snapshot for the triple: " + triple)
 
 platform, hash = me.strip().split(' ')
 
-tarball = 'cargo-nightly-' + platform + '.tar.gz'
+tarball = 'cargo-nightly-' + triple + '.tar.gz'
 url = 'http://static.rust-lang.org/cargo-dist/' + date.strip() + '/' + tarball
 dl_path = "target/dl/" + tarball
 dst = "target/snapshot"
@@ -32,6 +40,9 @@ dst = "target/snapshot"
 if not os.path.isdir('target/dl'):
     os.makedirs('target/dl')
 
+if os.path.isdir(dst):
+    shutil.rmtree(dst)
+
 ret = subprocess.call(["curl", "-o", dl_path, url])
 if ret != 0:
     raise Exception("failed to fetch url")
@@ -41,8 +52,10 @@ if h != hash:
 
 tar = tarfile.open(dl_path)
 for p in tar.getnames():
-    name = p.replace("cargo-nightly/", "", 1)
+    name = p.replace("cargo-nightly-" + triple + "/", "", 1)
     fp = os.path.join(dst, name)
     print("extracting " + p)
     tar.extract(p, dst)
+    shutil.move(os.path.join(dst, p), fp)
 tar.close()
+shutil.rmtree(os.path.join(dst, 'cargo-nightly-' + triple))
index f6b3fe04f63c07b86c6069fe5223ef63c2d4b474..5ddb34babe679f542b7c5ab09aebb12a9b3600c9 100644 (file)
@@ -11,13 +11,21 @@ print(date)
 if not os.path.isdir('target/dl'):
     os.makedirs('target/dl')
 
-snaps = ['mac', 'linux', 'win']
-for snap in snaps:
-    tarball = 'cargo-nightly-' + snap + '.tar.gz'
+snaps = {
+    'macos-i386': 'i686-apple-darwin',
+    'macos-x86_64': 'x86_64-apple-darwin',
+    'linux-i386': 'i686-unknown-linux-gnu',
+    'linux-x86_64': 'x86_64-unknown-linux-gnu',
+    'winnt-i386': 'i686-pc-mingw32',
+}
+
+for platform in sorted(snaps):
+    triple = snaps[platform]
+    tarball = 'cargo-nightly-' + triple + '.tar.gz'
     url = 'http://static.rust-lang.org/cargo-dist/' + date + '/' + tarball
     dl_path = "target/dl/" + tarball
     ret = subprocess.call(["curl", "-s", "-o", dl_path, url])
     if ret != 0:
         raise Exception("failed to fetch url")
     h = hashlib.sha1(open(dl_path, 'rb').read()).hexdigest()
-    print('  ' + snap + ' ' + h)
+    print('  ' + platform + ' ' + h)
index 7869ab79149750dd06b2c14cc6068681a0771dd2..d757ae812fdea8d9b9db0db305bfa92e05f14238 100644 (file)
@@ -1,3 +1,10 @@
+2014-07-30
+  linux-i386 4d4e78426060b891cf729d5e3cca86d5aebdd31d
+  linux-x86_64 2a39bb838bc1c740d41a2ee8054a2c32f1efbec8
+  macos-i386 16d1581dad71b1cf551646bc2dfdc920f4dda16c
+  macos-x86_64 05d836f2195e55f050e68e8bb209405a67fbefcb
+  winnt-i386 ade95f921ba73848d2ae67d1b8cd7c364e881e86
+
 2014-07-29
   mac 53f8bc39132e987d25e022698c3234fee0916ecf
   linux b7dbdc89126577fda2eef7d63c5f7fc1d8d28f99